#ifndef _SDL2_TP_H_
#define _SDL2_TP_H_

#include <SDL2/SDL.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

#define SDL2_TP_VERSION "1.0.0"

typedef enum _sdl2_key {
	SDL2_KEY_NXET = 1,
	SDL2_KEY_PREV,
	SDL2_KEY_LEFT,
	SDL2_KEY_RIGHT,
	SDL2_KEY_ENTER
} SDL2_KEY;

typedef struct _sdl2_tp {
	struct {
		struct {
			int reserved;
		} fix;
		struct {
			int reserved;
		} var;
	} cfg;
	struct {
		void* tid; // thread id
		bool quit; // windows close flag
		struct {
			bool pressed; // touchpad pressed flag
			int x;        // touchpad horizontal coord
			int y;        // touchpad vertical coord
		} tp;
		struct {
			bool next_pressed;  // keypad next pressed flag
			bool prev_pressed;  // keypad prev pressed flag
			bool left_pressed;  // keypad left pressed flag
			bool right_pressed; // keypad right pressed flag
			bool enter_pressed; // keypad enter pressed flag
		} kp;
		struct {
			bool pressed; // wheel pressed flag
			int offset;   // wheel roll offset
		} wl;
	} priv;
} sdl2_tp;

int sdl2_tp_init(sdl2_tp* tp);
void sdl2_tp_deinit(sdl2_tp* tp);
int sdl2_tp_event_poll(sdl2_tp* tp);
bool sdl2_tp_quit_get(sdl2_tp* tp);

int sdl2_tp_get_xy(sdl2_tp* tp, int* x, int* y);
bool sdl2_tp_is_pressed(sdl2_tp* tp);
int sdl2_key_get_keycode(sdl2_tp* tp);
bool sdl2_wheel_get_pressed(sdl2_tp* tp);
int sdl2_wheel_get_offset(sdl2_tp* tp);

#endif
